import java.util.LinkedList;

public class Listwork {
    public static void t1(){
        LinkedList list = new LinkedList();
        list.add(new News("001","每日早报","刘备"));
        list.add(new News("002","每日午报","张飞"));
        list.add(new News("003","每日晚报","关羽"));
        System.out.println("新闻标题数目为：" + list.size());

        News newlast = (News) list.getLast();
        News newfrist = (News) list.getFirst();
        System.out.print("排在最后的新闻标题是：");
        System.out.println(newlast.getNewName());

        System.out.print("删除开头的新闻的标题是：" + newfrist.getNewName());
        list.removeFirst();
        System.out.println();
        System.out.print("删除结尾的新闻的标题是：" + newlast.getNewName());
        list.removeLast();
        System.out.println();
        System.out.println("删除后剩余的新闻条数为：" + list.size());
    }

    public static void t2(){
        LinkedList list = new LinkedList();
        list.add(new Dog("欧欧","金毛"));
        list.add(new Dog("毛毛","泰迪"));
        list.add(new Dog("大黄","中华帝王犬"));
        list.add(new Dog("o((>ω< ))o","地狱三头犬"));
        for (Object o : list) {
            System.out.println(o);
        }
        Dog d1 = (Dog)list.getFirst();
        Dog d2 = (Dog)list.getLast();
        System.out.println("第一条狗狗的昵称是" + d1.getName());
        System.out.println("最后一条狗狗的昵称是" + d2.getName());
        System.out.println();
        list.removeFirst();
        list.removeLast();
        System.out.println("删除部分狗狗后还有" + list.size() + "条狗狗");
        for (Object o : list) {
            System.out.println(o);
        }
    }
    public static void t3(){
        LinkedList list = new LinkedList();
        list.add("刘翔宇");
    }
    public static void main(String[] args) {
        t2();
    }

}
